# @Version : 1.0
# @Author  : 刘宇
# @File    : 05_list_for.py
# @Time    : 2025/10/10 21:49

list_color = ['red', 'green', 'blue', 'yellow', 'white', 'black']

for ele in list_color:
    print(f"元素是:{ele}")

# 解决养鸡场问题
# list = [3, 5, 1, 3.4, 2, 50]
# total_weight = sum(list)
# print(total_weight)
# avg_weight = total_weight / len(list)
# print(avg_weight)

# 或者用循环
hens = [3, 5, 1, 3.4, 2, 50]
total_weight=0.0

for ele in hens:
    total_weight += ele
    print(total_weight)
